/*
 * @Author: your name
 * @Date: 2021-11-22 16:02:34
 * @LastEditTime: 2022-01-13 10:00:09
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \agricultural-production-web\src\main.js
 */
import Vue from "vue";

import "normalize.css/normalize.css"; // A mod/ern alternative to CSS resets

import "element-ui/packages/theme-chalk/src/index.scss";
import "@/styles/index.scss"; // global css
import 'element-ui/lib/theme-chalk/icon.css'
import '@/assets/font.css'

import App from "./App";
import store from "./store";
import router from "./router";

import "@/icons"; // icon

import i18n from "./lang";
import Cookies from "js-cookie";
import Element from "element-ui";

import {
  dateToFormat,
  dateToFormattwo,
  dateToFormatname,
  dateToFormatthree,
  dateToFormatFour,
  dateToFormatHM
} from "@/utils/validate";
Vue.prototype.dateToFormat = dateToFormat;
Vue.prototype.dateToFormattwo = dateToFormattwo;
Vue.prototype.dateToFormatname = dateToFormatname;
Vue.prototype.dateToFormatthree = dateToFormatthree;
Vue.prototype.dateToFormatFour = dateToFormatFour;
Vue.prototype.dateToFormatHM = dateToFormatHM;

// 统一大的请求地址
import $baseurl from '@/api/baseURL'
Vue.prototype.$cloudBaseurl = $baseurl.cloudBaseurl;
Vue.prototype.$baseurl = $baseurl;
Vue.prototype.$webSerUrl = $baseurl.webUrl;


// 国际化
Vue.use(Element, {
  size: Cookies.get("size") || "medium", // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
});

import Print from 'vue-print-nb' // 打印
Vue.use(Print) // 注册

// 禁止点击空白关闭
Element.Dialog.props.closeOnClickModal.default = false
//  以上级元素为大小
Element.Dialog.props.modalAppendToBody.default = false
// Element.Dialog.props.destroyOnClose.default = true
// 禁止点击空白关闭
Element.Dialog.props.modal.default = false


// 清除生产环境console.log
console.log = (function (log) {
  // eslint-disable-next-line eqeqeq
  return process.env.NODE_ENV == 'development' ? log : function () { }
}(console.log))

Vue.config.productionTip = false;
//import frameInRoutes from '@/router/routes'
//import "@/permission"; // permission control
Vue.prototype.$store = store;

new Vue({
  el: "#app",
  router,
  store,
  i18n,
  // created() {
  //   // 处理路由 得到每一级的路由设置
  //   this.$store.commit('page/init', frameInRoutes)
  // },
  render: h => h(App)
});
